<!DOCTYPE html>
<html lang="en">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>系统管理首页</title>
    <link rel="stylesheet" href="../css/bootstrap.css">
    <style>
        li{list-style: none;}
        a:visited{color: white}

    </style>
</head>
<body>
<!--顶部、主体-->
<div class="container">
    <div class="row text-center bg-black text-white">
        <div class="col-2">
            <img src="../img/logo.png" alt="" width="50%">
        </div>
        <div class="col-8 text-center"><p>欢迎使用图书管理系统</p></div>
        <div class="col-2">
            <span>当前用户:</span>
            <span th:text="${username}"></span>
            <span><a href="/logout">退出</a></span>
        </div>
    </div>
    <div class="row" style="min-height: 400px;">
        <div class="col-2 bg-dark text-light">
            <li><a href="/main">管理系统首页</a></li>
            <li><a href="/book/bookList">图书管理</a></li>
            <li><a href="/publishers">出版社管理</a></li>
        </div>
        <div class="col-10 pt-2">
            <!--            update内容区-->
            <p>更新该商品数据</p>
            <!--            <form action="/api/bookAddProcess" method="post">-->
            <div class="form-control">
                <label for="">序号</label>
                <input type="text" name="id" id="id" th:value="${data.id}" disabled="disabled">
            </div>
            <div class="form-control">
                <label for="">书名</label>
                <input type="text" name="bookname" id="bookname" th:value="${data.bookname}">
            </div>
            <div class="form-control">
                <label for="">借阅时间</label>
                <input type="text" name="borrow_time" id="borrow_time" th:value="${data.borrow_time}">
            </div>
            <div class="form-control">
                <label for="">状态</label>
                <input type="text" name="borrow_state" id="borrow_state" th:value="${data.borrow_state}">
            </div>
            <div class="form-control">
                <label for="">归还时间</label>
                <input type="text" name="back_time" id="back_time" th:value="${data.back_time}">
            </div>
            </div>
            <div class="form-control">
                <button class="btn btn-danger" id="btnupdate">更新</button>
            </div>
            </form>
        </div>
    </div>
    <div>
        @2023-2025 版本所有，违者必究
    </div>
</div>
</body>
</html>
<script src="../js/jquery.js"></script>
<script>
    $('#btnupdate').click(function (){
        var flag = confirm("确认提交更新？");
        if (res==true){
            $.post("/api/borrowUpdateProcess",{"id":$('#id').val(),"bookname":$('#bookname').val(),"borrow_time":$('#borrow_time').val(),
                "borrow_state":$('#borrow_state').val(),"back_time":$('#back_time').val()
            },function(res){
                if (res==1){
                    alert("更新成功");
                    location.href="/borrow/boorowList";
                }else{
                    alert("更新失败!");
                }
            })
        }
    })
</script>